package com.hrbu.springboot04.exception;

import lombok.Data;

/**
 * @Description: 自定义异常
 * @Author: tanyajun
 * @CreateTime: 2021/4/8
 * @Blog: https://tanyajun.top
 */
@Data
public class MyException extends RuntimeException {
    Integer code;
    String message;

    public MyException(Integer code, String message) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public MyException(String message, Integer code) {
        super(message);
        this.code = code;
        this.message = message;
    }

    public MyException() {
    }

    public MyException setCode(Integer code) {
        this.code = code;
        return this;
    }

    public MyException setMessage(String message) {
        this.message = message;
        return this;
    }
}
